package com.example.design.factory.version6.exercise;

/**
 * 简单工厂模式构建反射工厂
 */
public class Factory {

    public  static  Object     getInstance(String name){

        Object  obj=null;

        try {
            Class<?>    c=Class.forName(name);
           obj= c.newInstance();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
        return  obj;
    }
}
